//
//  GameLivingViewController.m
//  MobileGameLiving2
//
//  Created by reflection on 15/9/1.
//  Copyright (c) 2015年 李旭东. All rights reserved.
//

#import "GameLivingViewController.h"

@interface GameLivingViewController ()
@property (nonatomic,weak)UISegmentedControl *segment;
@end

@implementation GameLivingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.tabBarController.tabBar.hidden = YES;
    UIView *gameLiving = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 400, 375)];
    gameLiving.backgroundColor = [UIColor lightGrayColor];
    [self.view addSubview:gameLiving];
    UISegmentedControl *segment =[[UISegmentedControl alloc]initWithFrame:CGRectMake(0, 375, 400, 30)];
    [segment insertSegmentWithTitle:@"详细" atIndex:0 animated:YES];
    [segment insertSegmentWithTitle:@"聊天" atIndex:1 animated:YES];
    [segment addTarget:self action:@selector(talkAndText:) forControlEvents:UIControlEventValueChanged];
    self.segment = segment;
    [self.view addSubview:segment];
    // Do any additional setup after loading the view from its nib.
}

- (void)talkAndText:(id)sender {
    NSInteger selectdSegment = self.segment.selectedSegmentIndex;
    if (selectdSegment == 0) {
        UITextView *gameInfo = [[UITextView alloc]initWithFrame:CGRectMake(0, 405, 400, 240)];
        gameInfo.text = @"1234";
        [self.view addSubview:gameInfo];
    }else if (selectdSegment == 1){
        UITableView *chart = [[UITableView alloc]initWithFrame:CGRectMake(0, 405, 400, 140)];
        UITextField *insert = [[UITextField alloc]initWithFrame:CGRectMake(0, 585, 400, 35)];
//        chart.separatorStyle = UITableViewCellSeparatorStyleNone;
        insert.backgroundColor = [UIColor lightGrayColor];
        [self.view addSubview:chart];
        [self.view addSubview:insert];
    }
        
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
